
#include <BFile>
#include <BIcon>
#include <BImage>

#include "ReadWrite_ico.h"

ReadWrite_icon::ReadWrite_icon()
{

}
ReadWrite_icon::~ReadWrite_icon()
{

}

void ReadWrite_icon::setOptions(const BString& options)
{
	if (_options != options)
	{
		_options = options;
	}
}
const BString& ReadWrite_icon::options() const
{
	return _options;
}

BObject* ReadWrite_icon::load(const BString& fileName)
{
	BFile file(fileName);
	if (!file.open(IO_Read))
	{
		return 0;
	}
	IconHead head;
	file.read(head);
	for (int i = 0; i < head.idCount; i++)
	{
		BmpHead bmpHead;
		if (!file.read(bmpHead))
			break;
		BImage* image = new BImage();
	}
	BIcon* icon = new BIcon();
	return icon;
}
bool ReadWrite_icon::load(const BString& fileName, BObject* object)
{
	BFile file(fileName);
	if (!file.open(IO_Read))
	{
		return 0;
	}
	IconHead head;
	file.read(head);
	if (BIcon* icon = dynamic_cast<BIcon*>(object))
		return true;
	if (BImage* image = dynamic_cast<BImage*>(object))
		return true;
	return false;
}
bool ReadWrite_icon::save(const BString& fileName, const BObject* object) const
{
	return false;
}

BObject* ReadWrite_icon::read(const BBuffer& buffer)
{
	return 0;
}
bool ReadWrite_icon::read(const BBuffer& buffer, BObject* object)
{
	return false;
}
bool ReadWrite_icon::write(BBuffer& buffer, const BObject* object) const
{
	return false;
}

const BString& ReadWrite_icon::author() const
{
	return _author;
}
const BString& ReadWrite_icon::version() const
{
	return _version;
}
const BString& ReadWrite_icon::description() const
{
	return _description;
}
const BString& ReadWrite_icon::message() const
{
	return _message;
}
